#include <dos.h>

#include "alloc.h"

/*&h*/
typedef struct find_t tDirEnt;

/*&hf*/
int GetDir(char *Path, tDirEnt **List)
	{
	tDirEnt *p, Ent;
	int Count, Res;

	*List = NULL;
	if (_dos_findfirst(Path, 0xffff, &Ent) != 0)
		return (0);
	Count = 1;
	while (_dos_findnext(&Ent) == 0)
		Count++;
	if ((*List = xmalloc(tDirEnt, Count)) == NULL)
		return (-1);
	p = *List;
	if (_dos_findfirst(Path, 0xffff, &Ent) != 0)
		{
		xfree(*List);
		*List = NULL;
		return (0);
		}
	*p++ = Ent;
	while (p < *List + Count && _dos_findnext(&Ent) == 0)
		*p++ = Ent;
	return (p - *List);
	} /* GetDir() */


